<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>水平居中</title>
    <style>
        .container{
            width: 800px;
            height: 600px;
            border: 1px dotted red;
            text-align: center;/*文字居中*/
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: blue;
            margin: 0px auto;/*块元素居中 给自己设置margin就行*/
        }
        .box1{
            width: 300px;
            height: 200px;
            background-color: #990000;
            line-height: 200px;/**/
        }
    </style>
</head>
<body>
<div class="container">
    <div >练习水平居中</div>
    <hr>
    <div class="box">

    </div>
    <div class="box1">
        <span>你好</span>
    </div>
    <a href="#" >首页</a>
    <a href="#" >首页</a>
    <a href="#" >首页</a>
    <a href="#" >首页</a>
    <a href="#" >首页</a>
</div>
</body>
</html>